package com.itheima.exerciseTest.method30_39.method33;

import java.io.IOException;
import java.net.*;
import java.util.Random;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Random r = new Random();
        DatagramSocket ds = new DatagramSocket();

        while (true) {
            byte[] bytes = "您的余额已不足，请及时充值".getBytes();
            int port = r.nextInt(1000) + 10000;
            int i1 = r.nextInt(256);
            int i2 = r.nextInt(256);
            int i3 = r.nextInt(256);
            InetAddress byName = InetAddress.getByName("224." + i1 + "." + i2 + "." + i3);
            DatagramPacket dp = new DatagramPacket(bytes,bytes.length,byName,port);

            ds.send(dp);
        }

    }
}
